#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int x;
		cin >> x;
		int* arr = new int[x+1];
		int* arr2 = new int[x+1];
		int i = 0;
		for (i; i <x; i++)
		{
			int m = 0;
			cin >> m;
			arr[i] = m;
		}
		int flag = 1;
		int flag1 = 1;
		for (i = 0; i < x; i++)
		{
			int y = 0;
			cin >> y;
			arr2[i] = y ;
			
		}
		arr[x] = arr[0];
		arr2[x] = arr2[0];
		for (i = 0; i < x; i++)
		{
			if (arr2[i] < arr[i])
			{
				flag = 0;
				break;
			}
			else if(arr2[i]>arr[i])
			{
				
				if (arr2[i + 1] + 1 < arr2[i])
				{
					flag = 0;
					break;
				}
			}
		}
		
		if (flag)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}
}